﻿@page "/FinshedGetEmpty"
@inject FinshGetEmptyServer finshGetEmptyServer
@using System.ComponentModel
@using AntDesign.TableModels
@inject ModalService _modalService
@inject MessageService _message
<h3>工工装转运</h3>
<div>
    <Row>
        <Col Span="24">请选择取空工装点点</Col>
    </Row>
    <Row>
        <Col Span="24">
        <Select style="width:100%" DataSource="@DataList"
                AllowClear="true"
                ValueOnClear="@(0)"
                @bind-Value="@selet"
                ValueName="@nameof(FinishedPut_Entity.Deviceid)"
                LabelName="@nameof(FinishedPut_Entity.Remark)">
        </Select>
        </Col>
    </Row>
    <br>
    <Row>
        <Col Span="24">
        <Button style="width:100%" Type="@ButtonType.Primary" @onclick="@Creat">提交空工装转运任务</Button>
        </Col>
    </Row>
</div>

@code {
    ObservableCollection<FinishedPut_Entity> DataList { get; set; } = new ObservableCollection<FinishedPut_Entity>();
    int selet { get; set; } = 0;

    protected override async Task OnInitializedAsync()
    {
        var FinshGet = await finshGetEmptyServer.Getlist();
        if (FinshGet != null)
        {
            DataList.Clear();
            foreach (var item in FinshGet)
            {
                DataList.Add(item);
            }
        }

        base.OnInitialized();
    }
    private async Task Creat()
    {
        _modalService.Confirm(new ConfirmOptions()
        {
            Title = "提示",
            Icon =@<Icon Type="exclamation-circle" Theme="Outline"></Icon>,
OkText = "确认",
OnOk = async (e) =>
{
var aa = await finshGetEmptyServer.TaskCreat(selet);
_message.Info(aa);
},
CancelText = "取消",
Content = "是否提交？",
});



}
}
